<?php

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class AdminTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        DB::table('admin_users')->delete();
        DB::table('admin_permissions')->delete();
        DB::table('admin_user_permissions')->delete();
        //账户
        DB::table('admin_users')->insert([
            [
                'id'=>1,
                'username'=>'admin',
                'password'=>bcrypt('admin'),
                'name'=>'Administrator',
                'role_type'=>1,
                'created_at'=>\Carbon\Carbon::now(),
                'updated_at'=>\Carbon\Carbon::now(),
            ]
        ]);
        //权限
        DB::table('admin_permissions')->insert([
            [
                'id'=>1,
                'name'=>'All permission',
                'slug'=>'*',
                'http_path'=>'*',
                'created_at'=>\Carbon\Carbon::now(),
                'updated_at'=>\Carbon\Carbon::now(),
            ]
        ]);
        //用户- 权限关连
        DB::table('admin_user_permissions')->insert([
            [
                'user_id'=>1,
                'permission_id'=>1,
            ],
        ]);
    }
}
